﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZLCMS.Web.Wap.Code;
using DotNet.Common.Command;
using ZLCMS.Commands.Member.Commands.Product;
using NHibernate;
using DotNet.Common.NHibernateUtil;
 
namespace ZLCMS.Web.Wap.Shop
{
    public partial class ShoppingCartX : MemberPageBase
    {
        protected string Kind { get; set; }
        protected void Page_Load(object sender, EventArgs e)
        {
            Kind = Request["kind"];
            if (string.IsNullOrEmpty(Kind)) { Kind = "shop"; }

            int totalCnt = 0;
            using(ISession session = SessionFactoryHelper.CreateSession())
            {
                totalCnt = Convert.ToInt32(session.CreateQuery("select sum(ProductCount) from ShopShoppingCart where OwnerMember=:acc and  (Status='1' or Status='S') and Kind=:k ")
                    .SetParameter("k", Kind)
                    .SetParameter("acc", CurrentMemberAccount).UniqueResult());
            }
            if (totalCnt == 0)
            {
                Response.Redirect("EmptyShoppingCart.aspx");
            }

        }
    }
}